import pymysql

db = pymysql.connect(host="localhost", user="sunck", passwd="123456789", database="sunck")

cursor = db.cursor()

sql = 'insert into bandcard values(0, 100)'
try:
    cursor.execute(sql)
    # 提交数据
    db.commit()
except:
    # 如果提交失败，回滚到上一次数据
    db.rollback()


cursor.close()
db.close()